import "package:ct_pa_majordomo/pages/bill/accounting/index.dart";
import "package:ct_pa_majordomo/pages/bill/bill_collecting/index.dart";
import "package:ct_pa_majordomo/pages/bill/bill_manage/index.dart";
import "package:ct_pa_majordomo/pages/bill/collected/index.dart";
import "package:ct_pa_majordomo/pages/bill/index.dart";
import "package:ct_pa_majordomo/router/keys.dart";
import "package:flutter/material.dart";

class BillRoutes {
  static Map<String, WidgetBuilder> getRoutes(BuildContext context) {
    return {
      ///账单 账单列表
      Keys.BILL: (context, {arguments}) {
        // 处理 arguments 参数类型
        int current = 0;
        Map? params;
        
        if (arguments is Map) {
          current = arguments["current"] ?? 0;
          params = arguments["params"];
        } else if (arguments is int) {
          current = arguments;
        }
        
        return Bill(current: current, params: params);
      },
      ///账单 账单管理
      Keys.BILL_MANAGE: (context, {arguments}) => const BillManage(),
      ///账单 完成收款
      Keys.BILL_COLLECTING: (context, {arguments}) => BillCollecting(info: arguments),
      ///账单 收款
      Keys.BILL_COLLECTED: (context, {arguments}) => const Collected(),
      ///账单 记账
      Keys.BILL_ACCOUNTING: (context, {arguments}) => const Accounting(),
    };
  }
}